/*
 * Copyright 2020 The Kubernetes Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@use 'sass:math';
@import 'mixins';

@mixin ErrorDecorations {
  opacity: 0.625;
  background-color: var(--color-red);
}

@mixin NormalDecorations {
  opacity: 1;
  background-color: var(--color-table-border3);
}

@include Block {
  @include BlockBorder {
    background-color: transparent;
    border-left: none;
    border-right: none;
    border-radius: 2px;
    opacity: 0.5;
    content: '';
    left: 2px;
    position: absolute;
    top: 0;
    bottom: 0;
    width: $block-border-width;
  }
}
@include ActiveBlock {
  @include BlockBorder {
    background-color: $focus-color;
  }

  @include BlockFocusAttributes {
    @include BlockBorder {
      opacity: 1;
      background-color: $focus-color;
    }
  }
}

@include FocusedBlock {
  @include IsNotAnnouncement {
    @include IsNotActive {
      @include Editable {
        @include BlockBorder {
          @include NormalDecorations;
        }
      }
    }
  }
}
@include ErrorBlock {
  @include BlockNotFocusedAttributes {
    @include BlockBorder {
      @include ErrorDecorations;
    }
  }
}

/** Nested blocks, e.g. for commentary */
@include Block {
  @include Block {
    @include BlockBorder {
      left: calc(#{-$input-padding-left} + #{(math.div($block-border-width-px, 2) + em)} + 1px);
    }
  }
}
